//PITCH PROGRAM
//CLASS: GUI
//	-set up frame for the program
//BY: ALEX TRACY
import java.awt.*;
import javax.swing.*;
public class GUI extends JFrame
{
	private PlayerPanel[] pPanel = new PlayerPanel[4];
	private JLabel trumpLabel = new JLabel("");
	private JLabel bidLabel = new JLabel("");
	
	//constructor calls setGUI function
	public GUI(Player p[])
	{
		setGUI(p);
	}//End Constructor
	
	//initialize the gui by setting layout
	//to gridbag layout then making three
	//panels scoreArea, playArea, and 
	//informationArea
	//Play area contains all players and their cards
	//and the played area
	//Score area contains the score of the teams
	//Information area contains what is trump
	//who bid and how high they bid
	private void setGUI(Player p[])
	{
		setLayout(new GridBagLayout());
		JPanel playArea = new JPanel();
		playArea.setLayout(new GridBagLayout());
		GridBagConstraints c = new GridBagConstraints();
		
		c.fill = GridBagConstraints.VERTICAL;
		c.ipady = 200;     
		c.ipadx = 100;
		c.gridx = 2;
		c.gridy = 1;
		pPanel[3] = p[3].getPanel();
		playArea.add(pPanel[3],c);
	
		c.fill = GridBagConstraints.VERTICAL;
		c.ipady = 200;      
		c.ipadx = 100;
		c.gridx = 0;
		c.gridy = 1;
		pPanel[1] = p[1].getPanel();;
		playArea.add(pPanel[1],c);
		
		c.fill = GridBagConstraints.HORIZONTAL;
		c.ipady = 115;      
		c.ipadx = 200;
		c.gridx = 1;
		c.gridy = 0;
		pPanel[2] = p[2].getPanel();
		playArea.add(pPanel[2],c);
		
		c.fill = GridBagConstraints.HORIZONTAL;
		c.ipady = 115;     
		c.ipadx = 200;
		c.gridx = 1;
		c.gridy = 3;
		pPanel[0] = p[0].getPanel();
		playArea.add(pPanel[0],c);
		

		c.fill = GridBagConstraints.BOTH;
		c.ipady = 250;     
		c.ipadx = 250;
		c.gridx = 1;
		c.gridy = 1;
		playArea.add(new PlayedPanel(),c);
		
	
		c.gridx = 0;
		c.gridy = 0;
		add(playArea,c);
		
		
		c.gridx = 1;
		c.gridy = 0;
		add(new ScorePanel(),c);
		
		JPanel informationArea = new JPanel();
		c.gridx = 0;
		c.gridy = 1;
		informationArea.add(bidLabel);
		informationArea.add(trumpLabel);
		add(informationArea,c);
	}
	
	//set bid label
	public void setBidLabel(String b)
	{
		bidLabel.setText(b);
	}//end setBidLabel
	
	//set trump label and player who bid
	public void setTrumpLabel(int t)
	{
		trumpLabel.setText("Trump is " + Card.getSuitLetter(Play.getTrump()) + ".");
	}//end setTrumpLabel
	
}//End GUI
